<template>
  <div id="mvContainer"></div>
</template>

<script>
import { start, setDefaultMountApp } from 'qiankun'
import { storeToRefs } from 'pinia'
import { registerApps } from '@/micro/index.ts'
// 获取动态路由信息
import {useMenu} from '../../../store/menu';
export default {
  mounted() {
    if (!window.qiankunStarted) {
      window.qiankunStarted = true
      registerApps();
      // 默认加载第一个子路由
      const useMenuStore = useMenu();
      const { routerList } = storeToRefs(useMenuStore);
      let effectiveUrl = routerList.length ? routerList : JSON.parse(localStorage.getItem("effectiveUrl"));
      console.log('===============>',effectiveUrl);
      if (effectiveUrl) {
        setDefaultMountApp(effectiveUrl[0]);
      }
      start({
        sandbox: {
          experimentalStyleIsolation: true // 样式隔离
        },
        prefetch: false
      })
    }
  }
}
</script>
<style>

</style>